<?php
/**
 * Created by yb.
 * Author: 1021948372@qq.com
 * Date: 2020/7/7 07:07
 */
namespace app\admin\controller;

use app\common\lib\SessionCheck;

class User extends SessionCheck
{

    /**
     * 列表
     * @return mixed
     */
    public function index(){
        return $this->fetch();
    }

    public function getDataList(){
        $map = array();
        if(!empty(input('keyword'))){
            $map[] = ['phone|nickname','like','%' . input('keyword') . '%'];
        }
        if(!empty(input('start_date')) && !empty(input('end_date'))){
            $map[] = ['create_time','between',[strtotime(input('start_date')),strtotime(input('end_date')) + 86400]];
        }elseif(!empty(input('start_date'))){
            $map[] = ['create_time','>=',strtotime(input('start_date'))];
        }elseif(!empty(input('end_date'))){
            $map[] = ['create_time','<=',strtotime(input('end_date')) + 86400];
        }
        $result = model('User')->getPageListData('*',$map,'create_time desc');
        $this->success('获取成功','',$result);

    }

}